/*
 * global.h
 *
 *  Created on: 2011-8-7
 *      Author: minorityee1984@gmail.com
 *     Purpose:
 *        Note:
 */

#ifndef GLOBAL_H_
#define GLOBAL_H_

#include "logengine/logqueue.h"
#include "logengine/logthread.h"
#include "logengine/buffedlog.h"
#include "logengine/simplelog.h"
#include "loki/Singleton.h"

using namespace chenlib;

typedef CLogQueue<1> AgentServerLogQueueType;

typedef CBuffedLog<AgentServerLogQueueType> AgentServerLoggerType;

typedef Loki::SingletonHolder<AgentServerLoggerType> AgentServerLogger;
#define CREATE_AGENTSERVERLOGGER_INSTANCE	AgentServerLogger::Instance
#define GET_AGENTSERVERLOGGER_INSTANCE 		AgentServerLogger::Instance
#define WRITE_MAIN_LOG(loglevel, fmt, argv ...) \
		GET_AGENTSERVERLOGGER_INSTANCE().WriteLog(loglevel, "%s,%s(),%d:" fmt,  __FILE__,__FUNCTION__,__LINE__, ##argv)


typedef CLogThread<1> AgentServerLogThread;


typedef Loki::SingletonHolder<CSimpleLog> ServerLogger;
#define CREATE_SERVERLOGGER_INSTANCE	ServerLogger::Instance
#define GET_SERVERLOGGER_INSTANCE 		ServerLogger::Instance
#define WRITE_SERVER_LOG(loglevel, fmt, argv ...) \
		GET_SERVERLOGGER_INSTANCE().WriteLog(loglevel, "%s,%s(),%d:" fmt,  __FILE__,__FUNCTION__,__LINE__, ##argv)

#endif /* GLOBAL_H_ */
